package com.woniuxy.mapper;


import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.entity.Area;
import com.woniuxy.entity.Material;

@Mapper
public interface MaterialMapper {

	//查询所有物料
	@Select("select * from t_material1")
	public List<Material> findAllMaterial();
	
	//新增一条物料
	@Insert("insert into t_material1(maid,name,status,sort,time,description) values(default,#{name},#{status},#{sort},#{time},#{description})")
	public int addMaterial(Material material);
	
	//根据状态查询物料
	@Select("select * from t_material1 where status=#{status}")
	public List<Material> findMaterialByStatus(int status);
	
	//模糊查询
	@Select("select * from t_material1 where name like CONCAT('%',#{name},'%')")
	public List<Material> findMaterialByName(String name);
	
	//删除操作
	@Delete("delete from t_material1 where maid=#{maid}")
	public int delectMaterialByMaid(int maid);
		
	//改switch状态
	@Update("update t_material1 set status=#{status} where maid=#{maid}")
	public int updateSwitch(Material material);
	
	
	
	
}
